#!/usr/bin/env python2.5
# -*- coding: utf-8 -*-
# File: setup.py
# Author: Tomás Vírseda
# License: GPL v3
# Description:  distutils setup.py

import os
from distutils.core import setup

def give_files(dir, *extension):
    files=[]
    all_files=os.listdir(dir)
    for file in all_files:
        ext=(os.path.splitext(file))[1]
        if ext in extension:
            files.append(dir + file)
    return files


# List all the languages, separated by one whitespace
i18n_languages = "es en_GB"


def give_mo_file(lang):
    return "po/" + str(lang) + "/vazaar.mo"


def give_mo_path(lang):
    return "share/locale/" + str(lang) + "/LC_MESSAGES/"


def give_mo_tuples(langs):
    mo_tuple_list=[]
    for lang in langs.split(' '):
        mo_tuple_list.append((give_mo_path(lang), [give_mo_file(lang)]))
    return mo_tuple_list


temp_files = [
    # The paths are relative to sys.prefix
    #('share/doc/vazaar', give_files('data/doc/', '')),
    ('share/doc/vazaar',['AUTHORS', 'MANTAINERS', 'NEWS', 'TODO', 'README', 'COPYING', 'ChangeLog']),
    ('share/icons/hicolor/scalable/apps', ['data/icons/vazaar.svg']),
    ('share/applications', ['vazaar.desktop']),
    ('share/vazaar/data/icons', give_files('data/icons/', '.png', '.svg')),
    ('share/vazaar/data/glade', give_files('data/glade/', '.glade'))]
    #('share/man/man1/', ['man/lshell.1']) ],

#for lang_tuple in give_mo_tuples(i18n_languages):
#    temp_files.append(lang_tuple)


if __name__ == '__main__':

    setup(name='vazaar',
        version='0.4.1',
        description='Personal Information Manager',
        long_description="""Vazaar is a personal information manager based on tools and ideas \
borrowed from the semantic web area. It's (almost) all about metadata \
or data that describes other data.""",
        author='Tomás Vírseda (kaskaras)',
        author_email='kaskaras@gmail.com',
        maintainer='Tomás Vírseda (kaskaras)',
        maintainer_email='kaskaras@gmail.com',
        keywords=['rdf','rdflib','semantic web','python', 'pim', 'nepomuk', 'resources'],
        url='http://www.vazaar-project.org',
        license='GPL',
        platforms='UNIX',
        scripts= ['vazaar'],
        packages=[('vazaarlib'), ('vazaarlib/ui'), ('vazaarlib/ui/widgets')],
        data_files=temp_files,
        requires=[
            'rdflib (>= 2.4)',
            'feedparser',
            'webkit',
            'beautifulshoup',
            'lxml'
            ],
        classifiers=[
            'Development Status :: 4 - Beta',
            'Environment :: X11 Applications',
            'Environment :: X11 Applications :: Gnome',
            'Environment :: X11 Applications :: GTK',
            'Intended Audience :: End Users/Desktop',
            'Intended Audience :: Information Technology',
            'License :: DFSG approved',
            'License :: OSI Approved',
            'License :: OSI Approved :: GNU General Public License (GPL)',
            'Natural Language :: English',
            'Natural Language :: Spanish',
            'Operating System :: POSIX :: Linux',
            'Programming Language :: Python',
            'Programming Language :: Python :: 2.5',
            'Programming Language :: Python :: 2.6',
            'Topic :: Desktop Environment',
            'Topic :: Desktop Environment :: File Managers',
            'Topic :: Desktop Environment :: Gnome',
            'Topic :: Office/Business',
            'Topic :: Office/Business :: News/Diary',
            'Topic :: Utilities',
          ],
      )
